package com.jinyao.exploit.modules.sys.web;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jinyao.exploit.common.base.entity.BaseResult;
import com.jinyao.exploit.common.base.web.BaseController;
import com.jinyao.exploit.modules.sys.entity.Menu;
import com.jinyao.exploit.modules.sys.service.MenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 菜单Controller
 *
 * @author tm
 * @version 2019/06/26 15:22
 */
@RestController
@RequestMapping(value = "${baseAdminPath}/sys/menu")
public class MenuController extends BaseController {

    @Resource(name = "menuServiceImpl")
    private MenuService menuService;

    @RequestMapping(value = "list")
    public BaseResult list(Menu menu) {
        return BaseResult.ok(menuService.page(new Page<>(), Wrappers.query(menu)));
    }

    @RequestMapping(value = "save")
    public BaseResult save(Menu menu) {
        return BaseResult.ok(menuService.save(menu));
    }

}
